$input a_position, a_texcoord0
$output v_texcoord0, v_color, horizioncolor, cloudscolor, alfadata, worldpos

#include <bgfx_shader.sh>
#include <Fuctions_MLYX.glsl>

uniform mat4 CubemapRotation;
uniform vec4 FogAndDistanceControl;
uniform vec4 ViewPositionAndTime;
uniform vec4 FogColor;

void main() {
    vec4 color;
    v_color = color;
    v_texcoord0 = a_texcoord0;
    worldpos.xyz = vec3(a_position.x,a_position.y-0.202,a_position.z);
    bool InsuperiAquoris = FogAndDistanceControl.x==0.0&&FogAndDistanceControl.y<0.8&&(FogColor.b>FogColor.r||FogColor.g>FogColor.r);

    if(InsuperiAquoris){
        horizioncolor = vec3(0.2,0.3,0.5);
        cloudscolor = vec3(0.2,0.3,0.5);
        alfadata = 0.0;
    } else {
        float LloverDet = ViaALlover(FogAndDistanceControl.xyz);
        horizioncolor = CaeloHorizionte(LloverDet, FogColor.rgb);
        cloudscolor = ColorNubis(LloverDet, FogColor.rgb);
        alfadata = AlfaNubis(LloverDet, FogColor.rgb);
    }

    gl_Position = mul(u_modelViewProj, mul(CubemapRotation, vec4(a_position, 1.0)));
    //gl_Position = mul(u_modelViewProj, vec4(a_position,1.0));//删掉CubemapRotation
}
